# Maintainer: Daniel Isaksen <d@duniel.no>
pkgname=tmate
pkgver=2.4.0
pkgrel=4
pkgdesc="Instant Terminal Sharing"
url="https://tmate.io/"
arch="all"
license="ISC"
depends="ncurses-terminfo"
makedepends="
	autoconf
	automake
	bsd-compat-headers
	libevent-dev
	libssh-dev
	libtool
	msgpack-c-dev
	ncurses-dev
	zlib-dev
	"
subpackages="$pkgname-doc"
source="tmate-$pkgver.tar.gz::https://github.com/tmate-io/tmate/archive/$pkgver.tar.gz
	msgpack-c.patch
	implicit-decl.patch
	"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	CFLAGS="$CFLAGS -D_GNU_SOURCE"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 example_tmux.conf \
		"$pkgdir"/usr/share/doc/$pkgname/examples/$pkgname.conf
	for file in CHANGES FAQ README TODO; do
		install -m644 "$file" "$pkgdir"/usr/share/doc/$pkgname/
	done
}

sha512sums="
92d2ca354b295678bfc2747ca83a45ebafeaec40ebac94bd94c4926af4f820b3f3a087f365147f41c80d1c8ad032f52c697a2421839c39315d84f98f7eccada6  tmate-2.4.0.tar.gz
39db11866fc76178630244da3d6d555a2090d9bab9a54425344767bda130b30931198af6eb0c775cbe6b4f14987e0271dd30b7110b0591ac94dfc81b32486036  msgpack-c.patch
2d460f9caa6bf9bbd934512b545e8ef9c0616202aab7da7e4164f136efcffa341047a52b0c1879becd178fdb9e72914871916f0e2b5ac9990e95bbfd3ccb64a9  implicit-decl.patch
"
